MH-E supports the concept of multiple personalities or identities. This means that you can easily have a different header and signature at home and at work.
A couple of commands are used to insert identities in MH-Letter mode which are also found in the ‘Identity’ menu.
mh-insert-identity).
mh-auto-fields-list
(mh-insert-auto-fields).The ‘mh-identity’ customization group contains the following options.
mh-auto-fields-listnil).
mh-auto-fields-prompt-flagmh-identity-defaultmh-letter-mode is
called (default: ‘None’).
mh-identity-handlersmh-identity-list.
mh-identity-listnil).Some of the common header fields that people change depending on the context are the ‘From:’ and ‘Organization:’ fields, as well as the signature.
This is done by
customizing the option mh-identity-list. In the
customization buffer for this option, click on the
‘INS’ button
and enter a label such as ‘Home’ or ‘Work’. Then click on the
‘INS’ button
with the label ‘Add at least one
item below’. The ‘Value Menu’ has the following menu
items:
mh-extract-from-attribution-verb. See Inserting Letter.
mh-signature-file-name, a file, or a
function. See Signature.
You can select the identities you have added via the menu called
‘Identity’ in
the MH-Letter buffer. You can also use C-c C-d
(mh-insert-identity). To clear the fields and
signature added by the identity, select the
‘None’
identity.
The
‘Identity’
menu contains two other items to save you from having to set the
identity on every message. The menu item
‘Set Default for
Session’ can be used to set the default
identity to the current identity until you exit Emacs. The menu
item ‘Save as
Default’ sets the option
mh-identity-default to the current identity setting.
You can also customize the option
mh-identity-default in the usual fashion. If you
find that you need to add another identity, the menu item
‘Customize
Identities’ is available for your
convenience.
The option
mh-auto-fields-list can also be used to set the
identity depending on the recipient to provide even more control.
To customize mh-auto-fields-list, click on the
‘INS’ button
and enter a regular expression for the recipient's address (see
the section
Syntax of Regular Expressions in The GNU Emacs
Manual). Click on the ‘INS’ button with the
‘Add at least one item
below’ label. The ‘Value Menu’ contains the following
menu items:
mh-identity-list. All of the information for that
identity will be added if the recipient matches.
These fields can only be added after the recipient is known.
Because you can continue to add recipients as you edit the draft,
MH-E waits until the message is sent to perform the
auto-insertions. This seems strange at first, but you'll get used
to it. There are two ways to help you feel that the desired
fields are added. The first is the action when the message is
sent: if any fields are added automatically, you are given a
chance to see and to confirm these fields before the message is
actually sent. You can do away with this confirmation by turning
off the option mh-auto-fields-prompt-flag. The
second method is manual: once the header contains one or more
recipients, you may run the command C-c M-d
(mh-insert-auto-fields) or choose the
‘Identity -> Insert Auto
Fields’ menu item to insert these fields
manually. However, if you use this command, the automatic
insertion when the message is sent is disabled.
You should avoid using
the same header field in mh-auto-fields-list and
mh-identity-list definitions that may apply to the
same message as the result is undefined.
The option
mh-identity-handlers is used to change the way that
fields, signatures, and attributions in
mh-identity-list are added. To customize
mh-identity-handlers, replace the name of an
existing handler function associated with the field you want to
change with the name of a function you have written. You can also
click on an ‘INS’ button and insert a field of your
choice and the name of the function you have written to handle
it.
The
‘Field’ field
can be any field that you've used in your
mh-identity-list. The special fields
‘:attribution-verb’,
‘:signature’,
or ‘:pgg-default-user-id’ are used for the
mh-identity-list choices ‘Attribution Verb’,
‘Signature’,
and ‘GPG Key
ID’ respectively.
The handler associated with the ‘:default’ field is used when no other field matches.
The handler functions are passed two or three arguments: the field itself (for example, ‘From’), or one of the special fields (for example, ‘:signature’), and the action ‘'remove’ or ‘'add’. If the action is ‘'add’, an additional argument containing the value for the field is given.